<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <style>

    </style>
</head>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <fieldset class="table-search-fieldset">
                <legend>搜索信息</legend>
                <div style="margin: 10px 10px 10px 10px">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">统计时间</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="begin" id="begin" autocomplete="off" class="layui-input"
                                        placeholder="请选择时间范围起始">
                                </div>
                                <div class="layui-input-inline" style="width: 5px;">
                                    <span>-</span>
                                </div>
                                <div class="layui-input-inline" style="width: 225px;">
                                    <input type="text" name="end" id="end" autocomplete="off" class="layui-input"
                                        placeholder="请选择时间范围结束">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
            <div class="layui-tab-item layui-show">
                <script type="text/html" id="toolbarDemo">
                    <div class="layui-btn-container">
                        <button class="layui-btn layui-btn-normal  layui-btn-sm" lay-event="show" onclick="var options = {
                            href: 'billDetail2.html',
                            title: '对账单明细（月结）'
                        };
                        parent.layui.miniTab.openNewTabByIframe(options);"> 对账单明细
                        </button>
                    </div>
                </script>
                <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
            </div>
        </div>
    </div>

    <script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'table'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table;
            table.render({
                elem: '#currentTableId',
                url: '/bill',
                method: 'get',
                parseData: function (res) { //res 即为原始返回的数据
                    return {
                        "code": res.code, //解析接口状态
                        "count": res.count, //解析表格数据总条数 eg:共100页              
                        "data": res.data //解析table表格数据源
                    };
                },
                where: {
                    "mode": '3'
                }, //where用来传递请求时额外的参数 eg:productName
                cols: [
                    [{
                            field: 'bno',
                            width: 150,
                            title: '账单编号',
                            align: "center",
                            sort: true
                        }, {
                            field: 'pname',
                            width: 150,
                            title: '所属工地',
                            align: "center",
                            sort: true
                        },

                        {
                            field: 'receivetime',
                            width: 200,
                            title: '接收时间',
                            align: "center"
                        },

                        {
                            field: 'paytime',
                            width: 200,
                            title: '付款时间',
                            align: "center"
                        },
                        {
                            field: 'period',
                            width: 200,
                            title: '结算周期',
                            align: "center"
                        },
                        {
                            field: 'finalPrice',
                            title: '金额（元）',
                            width: 120,
                            align: "center",
                            sort: true,
                            templet: '<div>¥{{d.finalPrice}}</div>'
                        },

                        {
                            field: 'status',
                            title: '状态',
                            width: 100,
                            align: "center",
                            sort: true
                        },
                        {
                            title: '操作',
                            minWidth: 150,
                            toolbar: '#toolbarDemo',
                            align: "center"
                        }
                    ]
                ],
                skin: 'line'
            });

        });
    </script>

</body>

</html>